<template>
    <div>
        <div class="category-content">
            <h2 class="title">编辑分类：</h2>
            <ul class="list-ul">
                <li class="list-li">
                    <label>分类名称</label>
                    <input type="text" v-model="name">
                </li>
                <li class="list-li">
                    <label>分类备注</label>
                    <input type="text" v-model="remark">
                </li>
            </ul>
            <div class="btndiv">
                <input type="button" @click="addcate" value="提交">
            </div>
        </div>

    </div>
</template>
<script>
    export default {
        data() {
            return {
                name: "",
                remark: ""
            }
        },
        methods: {
            addcate: function () {
                this.$http.put(this.APIURL_PREFIX + '/api/wap/goodsTypeCustom', $.param({ id: this.$route.params.id, name: this.name, remark: this.remark })).then((response) => {
                    console.log(response.data);
                    layer.msg("修改成功!");
                    this.$router.push({ name: 'Business_category_ad' })
                }).catch(function (err) {
                    console.log(err)
                });
            },
            loadcateinfo: function () {
                this.$http.get(this.APIURL_PREFIX + '/api/wap/goodsTypeCustom/' + this.$route.params.id).then((response) => {
                    console.log(response.data);
                    this.name = response.data.data.name;
                    this.remark = response.data.data.remark;
                }).catch(function (err) {
                    console.log(err)
                });
            }
        },
        mounted() {
            this.loadcateinfo()
        },
        components: {

        }
    }
</script>
<style scoped>
    body {
        background-color: #FFFFFF;
    }

    .title {
        height: 2rem;
        text-align: left;
        line-height: 2rem;
        font-size: 0.85rem;
        color: #000000;
        padding-left: 0.5rem;
    }

    .list-ul {
        width: 100%;
        overflow: hidden;
    }

    .list-li {
        width: 100%;
        height: 2.5rem;
        line-height: 2.5rem;
        display: flex;
        border-bottom: 1px solid #e5e5e5;
    }

        .list-li label {
            margin-right: auto;
            margin-left: 0.5rem;
        }

        .list-li input {
            background: none;
            border: none;
            font-size: 14px;
            line-height: 2.5rem;
            text-align: right;
            padding: 0;
            margin: 0;
            height: 2.5rem;
            padding-right: 0.5rem;
            width: 15rem;
        }

    .btndiv input {
        display: block;
        width: 80%;
        height: 2.5rem;
        background: #ff0808;
        color: #ffffff;
        margin: 0 auto;
        margin-top: 3rem;
        border: none;
    }
</style>
